<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace App\Controller;

//use Hyperf\Contract\ConfigInterface;
//use Hyperf\Di\Annotation\Inject;
use Hyperf\Config\Annotation\Value;
use Hyperf\Logger\LoggerFactory;

class IndexController extends AbstractController
{
    /**
     * @var \Psr\Log\LoggerInterface
     */
    protected $logger;
	/**
	 * @Value("app_name")
	 */
	public $appName;

	public function __construct(LoggerFactory $loggerFactory)
    {
        $this->logger = $loggerFactory->get('hyperf', 'default');
    }

    public function index()
    {
        $user = $this->request->input('user', 'Hyperf');
        $method = $this->request->getMethod();
        $this->logger->info('I am in Index Controller');
        // echo 显示在终端里面
        echo "this output in terminal\n";
        return [
            'method' => $method,
            'message' => "Hello {$user}.",
			'name'=>$this->appName
        ];
    }
}
